package com.bwie.bwedu.model.impl;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.bwie.bwedu.bean.Student;
import com.bwie.bwedu.bean.response.BaseResponse;
import com.bwie.bwedu.model.AddStuListen;
import com.bwie.bwedu.model.SaveLocalStuModel;
import com.bwie.bwedu.volley.RequestAPI;

/**
 * Created by 沫沫~ on 2016/7/24.
 */
public class SaveLocalStuImpl implements SaveLocalStuModel {
	@Override
	public void SaveLocal(String per, String ptel, String stu, String stel, String adress, String IDcard, String id, String procurator, final AddStuListen addStuListen) {
		RequestAPI.saveLocal(per, ptel,stu, stel,adress,IDcard,id,procurator,new Response.Listener<BaseResponse>(){
			@Override
			public void onResponse(BaseResponse baseResponse) {
				if (baseResponse.ok==true){
					addStuListen.onSuccess("");
				}else{
					addStuListen.onFail(baseResponse.msg+"");
				}
			}
		},new Response.ErrorListener(){

			@Override
			public void onErrorResponse(VolleyError volleyError) {
				addStuListen.onFail("请检查网络");
			}
		});
	}
	public void SaveLocal(Student student, final AddStuListen addStuListen) {
		RequestAPI.saveLocal(student,addStuListen);
	}

}
